<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>jing/Mind</title>
    <link rel="stylesheet" href="./css/mind.css" />
  </head>
  <body>
    <div id="chart"></div>
    <button id="btn">新数据</button>

    <script type="module">
      import { data } from './js/假数据.js';
      import { Mind } from './js/Mind.js';

      const dom = document.querySelector('#chart');
      const mymind = new Mind(dom);

      const option = {
        data,
        initialTreeDepth: 2,
      };
      mymind.render(option);

      //新数据
      const btn = document.querySelector('#btn');
      btn.addEventListener('click', () => {
        mymind.render({
          data,
          initialTreeDepth: 1,
        });
      });
    </script>
  </body>
</html>
